<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	template="WEB-INF/template.xhtml">

	<ui:define name="content">
		<h:form>

			<p:dataTable var="logEntry" value="#{logs.logEntries}"
				paginator="true" rows="5" lazy="true"
				paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
				rowsPerPageTemplate="5,10,15" selection="#{logs.selectedLogEntry}"
				selectionMode="single" onRowSelectComplete="logEntryDialog.show()"
				onRowSelectUpdate="display" emptyMessage="Nothing to show"
				errorMessage="Error loading data" loadingMessage="Loading" style="width: 600px;">

				<f:facet name="header">
            Log entries
        </f:facet>

				<p:column headerText="Time">
					<h:outputText value="#{logEntry.logTime}" />
				</p:column>

				<p:column headerText="Level">
					<h:outputText value="#{logEntry.logLevel}" />
				</p:column>


			</p:dataTable>

			<p:dialog header="Log Entry Detail" widgetVar="logEntryDialog"
				resizable="false" width="200" showEffect="explode"
				hideEffect="explode">

				<h:panelGrid id="display" columns="2" cellpadding="4">

					<f:facet name="header">
                Details
            </f:facet>

					<h:outputText value="Time:" />
					<h:outputText value="#{logs.selectedLogEntry.logTime}" />

					<h:outputText value="Level:" />
					<h:outputText value="#{logs.selectedLogEntry.logLevel}" />

					<h:outputText value="Text:" />
					<h:outputText value="#{logs.selectedLogEntry.logText}" />
				</h:panelGrid>
			</p:dialog>

		</h:form>

	</ui:define>

</ui:composition>